package leetcode.code039;

import java.util.List;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public abstract class Solution39 implements IDebug {
	public abstract List<List<Integer>> combinationSum(int[] candidates, int target);

	@Override
	public void debug1() {
		// 输入: candidates = [2,3,6,7], target = 7
		// 输出: [[7],[2,2,3]]
		String str1 = "[2,3,6,7]";
		int target = 7;
		String str2 = "[[7],[2,2,3]]";
		this.debug(str1, target, str2);
	}

	private void debug(String str1, int target, String str2) {
		int[] candidates = HelpDebug.str2array3(str1);
		List<List<Integer>> result = this.combinationSum(candidates, target);
		List<List<Integer>> expect = HelpDebug.str2intlist1(str2);
		HelpDebug.compare(expect, result);
	}

	@Override
	public void debug2() {
		// 输入: candidates = [2,3,5], target = 8
		// 输出: [[2,2,2,2],[2,3,3],[3,5]]
		String str1 = "[2,3,5]";
		int target = 8;
		String str2 = "[[2,2,2,2],[2,3,3],[3,5]]";
		this.debug(str1, target, str2);
	}

	@Override
	public void debug3() {
		// 输入: candidates = [2], target = 1
		// 输出: []
		String str1 = "[2]";
		int target = 1;
		String str2 = "[]";
		this.debug(str1, target, str2);
	}

	@Override
	public void debug4() {
		// 输入: candidates = [1], target = 1
		// 输出: [[1]]
		String str1 = "[1]";
		int target = 1;
		String str2 = "[[1]]";
		this.debug(str1, target, str2);
	}

	public void debug5() {
		// 输入: candidates = [1], target = 2
		// 输出: [[1,1]]
		String str1 = "[1]";
		int target = 2;
		String str2 = "[[1,1]]";
		this.debug(str1, target, str2);
	}

}
